<template>
<div>
    <el-container>
        <el-header>
            <div>
                <span>企业用户</span>
                <div class="img-div">
                    <el-image style="width: 60px; height: 60px; border-radius: 50%" :src="imageUrl">
                    </el-image>
                </div>
                <!-- 下拉框 -->
                <el-select v-model="value" placeholder="我的" class="campus-enter-header-right" @change="goOther">
                    <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
                    </el-option>
                </el-select>
            </div>
        </el-header>

        <el-container>
            <el-aside width="160px">
                <!-- 侧边导航条 -->
                <el-menu :default-active="activeIndex" router class="el-menu-vertical-demo" background-color="#303133" text-color="#fff" active-text-color="#ffd04b" style="width: 160px">
                    <el-menu-item index="/entermain/enterpriseinfo">
                        <i class="el-icon-info"></i>
                        <span slot="title">企业信息</span>
                    </el-menu-item>
                    <el-menu-item index="/entermain/positionrelease">
                        <i class="el-icon-plus"></i>
                        <span slot="title">职位发布</span>
                    </el-menu-item>
                    <el-menu-item index="/entermain/viewpositing">
                        <i class="el-icon-document"></i>
                        <span slot="title">查看投递</span>
                    </el-menu-item>
                    <el-menu-item index="/entermain/interviewskills">
                        <i class="el-icon-share"></i>
                        <span slot="title">求职分享</span>
                    </el-menu-item>
                    <el-menu-item index="/entermain/entermeeting">
                        <i class="el-icon-setting"></i>
                        <span slot="title">校园宣讲</span>
                    </el-menu-item>
                    <el-menu-item index="/entermain/enterpriseappoint">
                        <i class="el-icon-s-data"></i>
                        <span slot="title">预约详情</span>
                    </el-menu-item>
                </el-menu>
            </el-aside>
            <el-container>
                <el-main>
                    <router-view></router-view>
                </el-main>
            </el-container>
        </el-container>
    </el-container>
</div>
</template>

<script>
export default {
    name: "RecommendEnterprisemain",

    data() {
        return {
            activeIndex: "/entermain/enterpriseinfo",
            options: [{
                    value: "1",
                    label: "个人信息",
                },
                {
                    value: "2",
                    label: "修改密码",
                },
                {
                    value: "3",
                    label: "退出",
                },
            ],
            value: "",
            imageUrl: "",
        };
    },

    created() {
        // 弹出通知
        this.$notify({
            title: "欢迎",
            message: "Welcome!!!",
        });
    },

    mounted() {
        this.loadHeadImg();
    },

    methods: {
        goOther(val) {
            if (val === "1") {
                this.$router.push("/enterpriseuser");
            } else if (val === "2") {
                this.$router.push("/enterpriseupdate");
            } else if (val === "3") {
                // 清除token
                window.localStorage.removeItem("token");
                this.$router.push("/login");
            }
        },
        loadHeadImg() {
            this.$axios
                .post("/enterprise/loadHeadImage")
                .then((res) => {
                    if (res.data.desc != "") {
                        this.imageUrl = res.data.desc;
                    } else {
                        return;
                    }
                })
                .catch((error) => {
                    console.log(error);
                    this.$message({
                        message: "系统错误!!!",
                        type: "error",
                    });
                });
        },
    },
};
</script>

<style scoped>
.el-header {
    background-color: #333;
    color: #333;
    line-height: 60px;
}

.el-aside {
    text-align: center;
    margin-top: 5px;
    padding: 0px;
    height: 565px;
    background: #303133;
    overflow: hidden;
}

.el-main {
    background: whitesmoke;
    margin-top: 5px;
    margin-left: 5px;
    padding: 0px;
    height: 565px;
}

.campus-enter-header-right {
    float: right;
    width: 75px;
}

span {
    color: white;
}

.img-div {
    float: right;
}
</style>
